// pages/homePage/homePage.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {

    indicatorDots: true,
    autoplay: true,
    interval: 2000,
    duration: 1000,
    productType: []
   
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // this.getUserLocation();
    //获取手机高度
    this.setData({
      navH: app.globalData.navHeight,
      partnerUserId: options.partnerUserId
    })
    const self = this
  },
  /**
   * 页面分享
   */
  onShareAppMessage: function () {
    var that = this;
    return {
      title: that.data.title,
      desc: '分享页面的内容',
      imageUrl: "http://file.jwsxmall.com/shareImg.jpg",
      path: '/pages/mentionCarPresent/mentionCarPresent?partnerUserId=' + wx.getStorageSync("userId") + '&type=2', // 路径，传递参数到指定页面
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    var that = this;

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
        } else {
          wx.navigateTo({
            url: '/pages/zcuslist/index?partnerUserId=' + that.data.partnerUserId + '&fan=1'
          })
        }
      }
    })
    /**
     * 获取4个类
     */
    wx.request({
      url: app.globalData.url + "getCardProduct",
      method: "GET",
      data: {
      },
      success: function (res) {
        var data = res.data.data;
        that.setData({
          groups: data
        })
      }
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


  /**
   * 跳转到产品详情
   */
  details: function (res) {
    var productid = res.currentTarget.dataset.productid;
    wx.navigateTo({
      url: '/pages/productDetail/productDetail?productid=' + productid + '&lipinka=' + res.currentTarget.dataset.type+'&type=6',
    })

  },
  navBack: function () {
    wx.switchTab({
      url: '/pages/mallPage/mallPage',
    })
  }
})